package Vista;
import java.awt.BorderLayout;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.ListModel;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import java.awt.event.ActionListener;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ProductoV extends javax.swing.JFrame {
	private JPanel PanelProducto;
	private JLabel lblcodpro;
	private JLabel lblnombrepro;
	private JComboBox cmbcodcategoria;
	private JTextField txtPrecio;
	private JButton btnañadir;
	private JLabel lblreceta;
	private JComboBox cmbingrediente;
	private JSeparator jSeparator2;
	private JList listaingrediente;
	private JTextField txtcantidad;
	private JButton btnregistrar;
	private JLabel lblprecio;
	private JLabel lblCantidad;
	private JLabel lblIngrediente;
	private JSeparator jSeparator1;
	private JButton btncancelar;
	private JTextField txtnombrepro;
	private JTextField txtcodprod;
	private JLabel lblcategoria;

	/**
	* Auto-generated main method to display this JFrame
	*/
		
	public ProductoV() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Registrar Producto");
			{
				PanelProducto = new JPanel();
				getContentPane().add(PanelProducto, BorderLayout.CENTER);
				PanelProducto.setLayout(null);
				{
					lblcodpro = new JLabel();
					PanelProducto.add(lblcodpro);
					lblcodpro.setText("Codigo del Producto:");
					lblcodpro.setBounds(286, 45, 170, 15);
					lblcodpro.setFont(new java.awt.Font("Bookman Uralic",2,14));
				}
				{
					lblnombrepro = new JLabel();
					PanelProducto.add(lblnombrepro);
					lblnombrepro.setText("Producto:");
					lblnombrepro.setBounds(45, 47, 141, 15);
					lblnombrepro.setFont(new java.awt.Font("Bookman Uralic",2,14));
				}
				{
					lblcategoria = new JLabel();
					PanelProducto.add(lblcategoria);
					lblcategoria.setText("Categoria:");
					lblcategoria.setBounds(42, 20, 165, 15);
					lblcategoria.setFont(new java.awt.Font("Bookman Uralic",2,14));
				}
				{
					txtcodprod = new JTextField();
					PanelProducto.add(txtcodprod);
					txtcodprod.setBounds(450, 43, 86, 22);
				}
				{
					txtnombrepro = new JTextField();
					PanelProducto.add(txtnombrepro);
					txtnombrepro.setBounds(125, 45, 120, 22);
				}
				{
					ComboBoxModel cmbcodcategoriaModel = 
						new DefaultComboBoxModel(
								new String[] { "Seleccione..", "" });
					cmbcodcategoria = new JComboBox();
					PanelProducto.add(cmbcodcategoria);
					cmbcodcategoria.setModel(cmbcodcategoriaModel);
					cmbcodcategoria.setBounds(131, 16, 98, 22);
					cmbcodcategoria.setFont(new java.awt.Font("Bookman Uralic",2,14));
				}
				{
					btnregistrar = new JButton();
					PanelProducto.add(btnregistrar);
					btnregistrar.setText("Registrar");
					btnregistrar.setBounds(160, 283, 132, 53);
					btnregistrar.setFont(new java.awt.Font("Bookman Uralic",2,12));
					btnregistrar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/cajareg.png")));
				}
				{
					btncancelar = new JButton();
					PanelProducto.add(btncancelar);
					btncancelar.setText("Cancelar");
					btncancelar.setBounds(373, 283, 132, 53);
					btncancelar.setFont(new java.awt.Font("Bookman Uralic",2,12));
					btncancelar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/48px-Crystal_Clear_action_stop.png")));
				}
				{
					jSeparator1 = new JSeparator();
					PanelProducto.add(jSeparator1);
					jSeparator1.setBounds(33, 99, 590, 10);
				}
				{
					lblIngrediente = new JLabel();
					PanelProducto.add(lblIngrediente);
					lblIngrediente.setText("Ingrediente:");
					lblIngrediente.setBounds(87, 117, 92, 15);
					lblIngrediente.setFont(new java.awt.Font("Bookman Uralic",2,14));
				}
				{
					lblCantidad = new JLabel();
					PanelProducto.add(lblCantidad);
					lblCantidad.setText("Cantidad:");
					lblCantidad.setBounds(328, 117, 73, 15);
					lblCantidad.setFont(new java.awt.Font("Bookman Uralic",2,14));
				}
				{
					lblprecio = new JLabel();
					PanelProducto.add(lblprecio);
					lblprecio.setText("Precio:");
					lblprecio.setBounds(244, 234, 57, 15);
					lblprecio.setFont(new java.awt.Font("Bookman Uralic",2,14));
				}
				{
					txtcantidad = new JTextField();
					PanelProducto.add(txtcantidad);
					txtcantidad.setBounds(402, 114, 99, 22);
				}
				{
					ListModel listaingredienteModel = 
						new DefaultComboBoxModel(
								new String[] { " ", " " });
					listaingrediente = new JList();
					PanelProducto.add(listaingrediente);
					listaingrediente.setModel(listaingredienteModel);
					listaingrediente.setBounds(45, 143, 578, 82);
				}
				{
					txtPrecio = new JTextField();
					PanelProducto.add(txtPrecio);
					txtPrecio.setBounds(313, 231, 101, 22);
				}
				{
					ComboBoxModel cmbingredienteModel = 
						new DefaultComboBoxModel(
								new String[] { "Seleccione...", " " });
					cmbingrediente = new JComboBox();
					PanelProducto.add(cmbingrediente);
					cmbingrediente.setModel(cmbingredienteModel);
					cmbingrediente.setBounds(176, 113, 142, 22);
					cmbingrediente.setFont(new java.awt.Font("Bookman Uralic",2,14));
				}
				{
					jSeparator2 = new JSeparator();
					PanelProducto.add(jSeparator2);
					jSeparator2.setBounds(41, 265, 574, 10);
				}
				{
					lblreceta = new JLabel();
					PanelProducto.add(lblreceta);
					lblreceta.setText("Receta");
					lblreceta.setBounds(292, 78, 63, 15);
					lblreceta.setFont(new java.awt.Font("Bookman Uralic",2,18));
				}
				{
					btnañadir = new JButton();
					PanelProducto.add(btnañadir);
					btnañadir.setBounds(513, 103, 41, 35);
					btnañadir.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/otro.2.png")));
				}
			}
			pack();
			this.setSize(660, 383);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	public JComboBox getCmbcodcategoria() {
		return cmbcodcategoria;
	}

	public void setCmbcodcategoria(JComboBox cmbcodcategoria) {
		this.cmbcodcategoria = cmbcodcategoria;
	}

	public JTextField getTxtPrecio() {
		return txtPrecio;
	}

	public void setTxtPrecio(JTextField txtPrecio) {
		this.txtPrecio = txtPrecio;
	}

	public JComboBox getCmbingrediente() {
		return cmbingrediente;
	}

	public void setCmbingrediente(JComboBox cmbingrediente) {
		this.cmbingrediente = cmbingrediente;
	}

	public JTextField getTxtcantidad() {
		return txtcantidad;
	}

	public void setTxtcantidad(JTextField txtcantidad) {
		this.txtcantidad = txtcantidad;
	}

	public JTextField getTxtnombrepro() {
		return txtnombrepro;
	}

	public void setTxtnombrepro(JTextField txtnombrepro) {
		this.txtnombrepro = txtnombrepro;
	}

	public JTextField getTxtcodprod() {
		return txtcodprod;
	}

	public void setTxtcodprod(JTextField txtcodprod) {
		this.txtcodprod = txtcodprod;
	}

	public void addListener(ActionListener actionListener) {
		btnregistrar.addActionListener(actionListener);
		btncancelar.addActionListener(actionListener);
		btnañadir.addActionListener(actionListener);
	}
	public void Limpiar()
	{
		txtnombrepro.setText("");
		txtcodprod.setText("");
		txtcantidad.setText("");
		txtcodprod.setText("");
		cmbcodcategoria.setToolTipText("");
		listaingrediente.setToolTipText("");
		
	}
	
	
	public JList getListaingrediente() {
		return listaingrediente;
	}

	public void mensaje(String sms)
	{
		JOptionPane.showMessageDialog(this, sms);
	}
}